#!/bin/sh


helm repo add moikot https://moikot.github.io/helm-charts

helm search repo moikot/nfs-client-provisioner

helm pull moikot/nfs-client-provisioner --version=1.3.0 --untar

helm install nfs-storage nfs-client-provisioner \
--set nfs.server=10.0.2.8 \
--set nfs.path=/data/public \
--set storageClass.name=nfs-storage \
--set storageClass.defaultClass=true


sudo chmod -R 777 /data/public

cat > nfs-pvc.yaml <<EOF
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: nfs-pvc
spec:
  storageClassName: "nfs-storage"
  accessModes:
    - ReadWriteMany
  resources:
    requests:
      storage: 100Mi
EOF

kubectl apply -f nfs-pvc.yaml

# Please vim /etc/kubernetes/manifests/kube-apiserver.yaml 
# To add --feature-gates=RemoveSelfLink=false
# spec:
#  containers:
#  - command:
#    - kube-apiserver
#    - --feature-gates=RemoveSelfLink=false
#    - --advertise-address=10.0.2.8
#    - --allow-privileged=true


kubectl delete -f nfs-pvc.yaml
rm nfs-pvc.yaml